home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / tex / dvivga9.arc / ABORTRUN.H next >
Text File  |  1988-06-11  |  1KB  |  50 lines

  1. /* -*-C-*- abortrun.h */
  2. /*-->abortrun*/
  3. /**********************************************************************/
  4. /***************************  abortrun  *******************************/
  5. /**********************************************************************/
  6.  
  7. void
  8. abortrun(code)
  9. int code;
  10.  
  11. {
  12.     /*******************************************************************
  13.     This routine  is called  on both  success and  failure to  terminate
  14.     execution.  All open files (except stdin, stdout, stderr) are closed
  15.     before calling EXIT() to quit.
  16.     *******************************************************************/
  17.  
  18.  
  19.  
  20.     UNSIGN16 k;
  21.  
  22.     for (k = 0; k < (UNSIGN16)nopen; ++k)
  23.     if (font_files[k].font_id != (FILE*)NULL)
  24.         (void)fclose(font_files[k].font_id);
  25.  
  26.     if (dvifp != (FILE*)NULL)
  27.         (void)fclose(dvifp);
  28.     if (plotfp != (FILE*)NULL)
  29.         (void)fclose(plotfp);
  30.     if (g_dolog && (g_logfp != (FILE *)NULL))
  31.     (void)fclose(g_logfp);
  32.  
  33. #if    (OS_TOPS20 | OS_VAXVMS)
  34.     if (code)
  35.     {
  36.     NEWLINE(stderr);
  37.     (void)fprintf(stderr,"?Aborted with error code %d",code);
  38.     NEWLINE(stderr);
  39.     (void)perror("?perror() says");
  40.     }
  41. #endif
  42.  
  43. #if    VGASCREEN
  44.     devterm();
  45. #endif
  46.  
  47.     (void)EXIT(code);
  48. }
  49.  
  50.